package train_array.day2;

import java.util.*;



public class cdoe1 {


    public class demo{
        public int data;
        public int number;

        public demo(int data, int number) {
            this.data = data;
            this.number = number;
        }

        public int getData() {
            return data;
        }

        public void setData(int data) {
            this.data = data;
        }

        public int getNumber() {
            return number;
        }

        public void setNumber(int number) {
            this.number = number;
        }
    }


    public String fun(int[] array){
        ArrayList<demo> list = new ArrayList<>();
        HashMap<Integer,Integer> map = new HashMap<>();

        for(int i=0;i<array.length;i++){
            if(map.containsKey(array[i])){
                int index = map.get(array[i]);
                list.get(index-1).number += 1;

            }else {
                int index = list.size();
                map.put(array[i],index+1);
                demo d = new demo(array[i], 1);
                list.add(d);
            }
        }

        list.sort( (o1,o2) -> o2.getNumber()-o1.getNumber());

        StringJoiner sj = new StringJoiner(",");
        for (demo d:list){
            sj.add(String.valueOf(d.getData()));
        }
        return sj.toString();

    }







    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(",");

        int[] array = new int[str.length];
        for (int i=0;i<str.length;i++){
            array[i] = Integer.parseInt(str[i]);
        }


    }
}
